package com.lin.spring.service.impl;

import com.lin.spring.dao.UserMapper;
import com.lin.spring.entity.User;
import com.lin.spring.service.UserService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @ClassName AnnoUserServiceImpl
 * @Description
 * @Author lin
 * @Date 2021/11/24 下午10:17
 * @Version V1.0
 */
// @Transactional(readOnly = true,isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED)
@Service
public class AnnoUserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;



    @Transactional(readOnly = true)
    @Override
    public void insertUser(User user) {
        userMapper.insertUser(user);
        int i = 3/0;
    }

    @Transactional(readOnly = true)
    @Override
    public User findUserById(int id) {
        User userById = userMapper.findUserById(id);
        return userById;
    }

}
